home *** CD-ROM | disk | FTP | other *** search
- /****************************************************************************************************
- 6/96 bob Updated #includes to support changed GX Library names.
-
- ©1990 - 1996 Apple Computer, Inc.
- All rights reserved.
- ****************************************************************************************************/
- #include <Types.h>
- #include <QuickDraw.h>
- #include <Fonts.h>
- #include <Windows.h>
- #include <Menus.h>
- #include <SegLoad.h>
- #include <Memory.h>
- #include <Desk.h>
-
- #include <GXGraphics.h>
- #include "GraphicsLibraries.h"
- #include <GXEnvironment.h>
-
- #include <GXTypes.h>
- #include <GXLayout.h>
- #include "LayoutLibrary.h"
-
- #include "SampleInterface.h"
-
- short MyStrLen(char *x);
- static short MyStrLen(x)
- char *x;
- {
- short c = 0;
- while (*x++) c++;
- return c;
- } /* MyStrLen */
-
- static char arabicString[8] = {'\xE5', '\xC7', '\xE3', '\xE6', '\xCA', '\xE8', '\xD4', 0};
-
- void SplitPolarizedCarets(WindowPtr sampleWindow)
- {
- /* Variables */
- char *romanString = "Mega";
- gxPoint myPoint;
- gxShape caret, layout;
- short len, level = 0, runLengths[2];
- gxStyle arabicStyle, romanStyle, styleArray[2];
- gxViewPort aViewPort;
- void *textPtrs[2];
-
- /* Initialization */
-
- myPoint.x = ff(20);
- myPoint.y = ff(50);
-
- aViewPort = GXNewWindowViewPort(sampleWindow);
- SetDefaultViewPort(aViewPort);
-
- runLengths[0] = 4;
- runLengths[1] = 7;
- len = runLengths[0] + runLengths[1];
-
- textPtrs[0] = romanString;
- textPtrs[1] = &arabicString[0];
-
- romanStyle = NewLayoutStyle((char *) "\pHoefler Text", ff(60), 0, nil, nil, 0, nil);
- arabicStyle = NewLayoutStyle((char *) "\pBaghdad Plain", ff(60), 0, nil, nil, 0, nil);
-
- styleArray[0] = romanStyle;
- styleArray[1] = arabicStyle;
-
- layout = GXNewLayout(
- 2, runLengths, (void *)textPtrs,
- 2, runLengths, styleArray,
- 1, &len, &level,
- nil, &myPoint);
- GXDrawShape(layout);
-
- caret = GXGetLayoutCaret(layout, 4, gxHighlightStraight, gxSplitCaretType, nil);
- GXDrawShape(caret);
-
- GXMoveShape(layout, 0, ff(75));
- GXDrawShape(layout);
- GXGetLayoutCaret(layout, 4, gxHighlightStraight, gxLeftRightKeyboardCaret, caret);
- GXDrawShape(caret);
-
- GXMoveShape(layout, 0, ff(75));
- GXDrawShape(layout);
- GXGetLayoutCaret(layout, 4, gxHighlightStraight, gxRightLeftKeyboardCaret, caret);
- GXDrawShape(caret);
-
- GXDisposeShape(caret);
- GXDisposeShape(layout);
- GXDisposeStyle(arabicStyle);
- GXDisposeStyle(romanStyle);
- GXDisposeViewPort(aViewPort);
- } /* main */
-